The invention relates to a fault tolerant data storing method implemented in a NAND-Flash memory.
Many embedded systems have memory systems consisting of read-only memory and random access memory (ROM+RAM). The random access memory has high access performance, and is therefore used as working memory for an operation system or program execution. Nevertheless, information stored in RAM is lost after a power is switched off. Read-only memory is thus used for storing the operation system software and other important information. NAND-Flash or NOR-Flash is generally used as a storage mechanism for Read-only memory, such as a hard disk in a computer.
For an embedded system, three parts of information is stored in NAND-Flash, i.e., (1) bootstrap information (Nboot); (2) operation system information (OS); and (3) user information (free space).
When a system is initiated, a CPU retrieves Nboot from a Flash, and loads and executes the retrieved Nboot in a RAM. Similar to BIOS in a computer, Nboot directs system initialization, retrieves operation system software from flash, loads and executes the operation system software in RAM, and performs a boot process accordingly.
A conventional embedded system has the following disadvantages. Before a device equipped with an embedded system leaves the factory, Nboot information and OS information has been stored in Flash memory of the device. The Nboot and OS information is written into Flash using JTAG or an external Flash writer. Using JTAG for writing data is time consuming. Accordingly, an external Flash writer is generally used for writing data into Flash. Among blocks in a Flash memory, only block 0 is guaranteed to be fault-free. Accordingly, when a bad block exists among the blocks storing OS information and the Flash writer fails to handle this bad block, the OS information cannot be written into Flash correctly. Accordingly, the operation system cannot initiate properly because of the bad block. Under this circumstance, it takes time to re-write correct data into Flash of the device via a USB device of a computer.